<template>
  <div class="kaocha-details">
    <el-breadcrumb separator=">">
      <el-breadcrumb-item :to="{ path: '/' }">系统首页</el-breadcrumb-item>
      <el-breadcrumb-item :to="{ path: '/selection' }">干部选任</el-breadcrumb-item>
      <el-breadcrumb-item>考察</el-breadcrumb-item>
    </el-breadcrumb>
    <section class="wboxnoborder">
      <div :style="'height:'+tableHeight+'px'">
        <el-scrollbar style="height: calc(100% + 16px);">
          <el-form
            label-width="140px"
            label-position="right"
            :inline="true"
            style="margin:15px 25px 0;">
            <el-form-item label="姓名">
              <span class="selectioncontent">
                {{tuijianperson.realName}}
              </span>
            </el-form-item>
            <el-form-item label="动议岗位单位">
              <span class="selectioncontent">
                {{tuijianperson.unitName}}
              </span>
            </el-form-item>
            <el-form-item label="动议岗位职务">
              <span class="selectioncontent">
                {{tuijianperson.jobName}}
              </span>
            </el-form-item>
            <el-form-item label="动议岗位职级">
              <span class="selectioncontent">
                {{tuijianperson.jobLevel}}
              </span>
            </el-form-item>
            <div style="clear:both"></div>
          </el-form>
          <kaochadetail :personId='personId'></kaochadetail>
          <el-form ref="form"
            :model="kaochaForm"
            label-width="120px"
            label-position="right"
            :inline="true"
            style="margin:0 15px;">
            <el-form-item>
              <el-button type="primary" @click="backlist()" style="margin-left:150px">返回</el-button>
            </el-form-item>
          </el-form>
        </el-scrollbar>
      </div>
    </section>
  </div>
</template>

<script>
import kaochadetail from './detail'
export default {
  components: {
    kaochadetail
  },
  name: 'kaocha-details',
  data () {
    return {
      personId: '',
      tuijianperson: {},
      tableHeight: 100,
      params: {},
      kaochaForm: {
        name: '',
        date: '',
        date2: '',
        num: 0,
        num2: 0,
        num3: 0,
        num4: 0,
        beizhu: '',
        zyqk: '',
        rqbg: '',
        hcr: '',
        problem: '',
        hasproblem: ''
      },
      ftsb: [
        {
          ftsb1: '',
          ftsb2: '',
          ftsb3: '',
          ftsb4: ''
        }
      ],
      files: [],
      fileList: [],
      selectData: {
        hjData: [
        ],
        szData: [
        ],
        cnData: [],
        yyData: []
      },
      loading: false
    }
  },
  methods: {
    inRoles (str) {
      console.log(str)
      let arr = JSON.parse(localStorage.getItem('Roles'))
      // arr = 'aaabbROLE_admin'
      if (arr.indexOf(str) === -1) {
        return false
      } else {
        return true
      }
    },
    backlist () {
      if (this.inRoles('ROLE_sizhang') || this.inRoles('ROLE_fusizhang')) {
        this.$router.replace({
          name: 'kaochaleader'
        })
      } else {
        this.$router.replace({
          name: 'kaocha',
          params: {
            step: 2
          }
        })
      }
    },
    tableresize (obj) {
      var clientHeight = 0
      if (document.body.clientHeight && document.documentElement.clientHeight) {
        clientHeight = (document.body.clientHeight < document.documentElement.clientHeight) ? document.body.clientHeight : document.documentElement.clientHeight
      } else {
        clientHeight = (document.body.clientHeight > document.documentElement.clientHeight) ? document.body.clientHeight : document.documentElement.clientHeight
      }
      obj.$nextTick(function () {
        obj.tableHeight = clientHeight - 165
      })
    }
  },
  mounted () {
    this.tuijianperson = this.$route.params

    if (this.tuijianperson.id) {
      this.personId = this.tuijianperson.id
    }
    if (this.tuijianperson.busCandidatePersonId) {
      this.personId = this.tuijianperson.busCandidatePersonId
    }
    console.log('this.tuijianperson')
    console.log(this.tuijianperson)
    this.tableresize(this)
    let _this = this
    window.onresize = function windowResize () {
      // 通过捕获系统的onresize事件触发我们需要执行的事件
      _this.tableresize(_this)
    }
  }
}
</script>

<style>
.kaocha-details .el-table--border td, .el-table--border th, .el-table__body-wrapper .el-table--border.is-scrolling-left~.el-table__fixed{
  border-bottom:1px solid #95B8E7;
}
.kaocha-details .el-table td, .el-table th.is-leaf{
  border-right:1px solid #95B8E7;
}
.kaocha-details .wboxnoborder .el-table{
  border: #95B8E7 solid 1px;
}
.kaocha-details .wboxnoborder .el-table th{
  font-weight: normal;
  background-image: linear-gradient(to bottom , #f8f8f8, #efefef);
  text-align: center;
  border-right: #95B8E7 solid 1px;
  border-bottom: #95B8E7 solid 1px;
  min-height: 30px;
  line-height:30px;
}
.kaocha-details .wboxnoborder .el-table td, .el-table th{
  padding:0;
  font-size:var(--size14) !important;
  line-height: 20px;
  font-family: '宋体';
  text-align: center;
}
.kaocha-details .el-table__row{
  height: 50px;
}
.kaocha-details .el-form-item__content{
  font-weight: bolder;
}
</style>
<style scoped>
.kaocha-details {
  width: 100%;
}
.sel-tit {
  padding: 0 15px;
  box-sizing: border-box;
  float: left;
  text-align: right;
}
.sel-con {
  width: 100%;
  padding: 0 15px;
  box-sizing: border-box;
  float: left;
  border-bottom: 0.5px solid #909399;
  font-size: 14px;
}
.sel-fl {
  float: left;
  font-weight: bolder;
}
.kaocha-details .wboxnoborder {
  padding: 0;
  width: 100%;
  background-color: #fff;
  margin: 0 10px;
  overflow: hidden;
}
</style>
